#ifndef __STARTSELECT_H__
#define __STARTSELECT_H__

// Includes
#include <PA9.h>       // Include for PA_Lib

#include "Init.h"
#include "Boost.h"
#include "Chests.h"
#include "Guage.h"


//initial button-- "Eliminate the Disturbance"
void eliminateButton()
{
	//save initial button time
	buttonTime = Tick(gameClock);
	
	//make button visible
	PA_SetSpriteAnim(0, 11, 13);
	PA_SetSpriteAnim(0, 12, 14);
	
	while(touchButton == false)
	{
		//if button touched or Start button pressed, unpause
		if(((PA_SpriteTouched(11)) || (PA_SpriteTouched(12)))
		&& ((buttonTime + buttonRelease) <= Tick(gameClock)))
		{
			//hide button
			PA_SetSpriteAnim(0, 11, 0);
			PA_SetSpriteAnim(0, 12, 0);
			
			//save current button time
			buttonTime = Tick(gameClock);
			
			touchButton = true;	//set flag
		}
	
	}
	
	//reset flag
	touchButton = false;
}




void startButton()
{
	PA_StopSpriteAnim(0, avSprNo); //stop any previous sprite animation
	
	//save initial button time
	buttonTime = Tick(gameClock);
	
	//dim screen
	PA_SetDSLBrightness(0);
	
	//make button visible
	PA_SetSpriteAnim(0, 11, 11);
	PA_SetSpriteAnim(0, 12, 12);
	
	while(touchButton == false)
	{
		//if button touched or Start button pressed, unpause
		if(((PA_SpriteTouched(11)) || (PA_SpriteTouched(12)) || Pad.Newpress.Start)
		&& ((buttonTime + buttonRelease) <= Tick(gameClock)))
		{
			//hide button
			PA_SetSpriteAnim(0, 11, 0);
			PA_SetSpriteAnim(0, 12, 0);
			
			//save current button time
			buttonTime = Tick(gameClock);
			
			//undim
			PA_SetDSLBrightness(3);
			
			touchButton = true;	//set flag
		}
	
	}
	
	//reset flag
	touchButton = false;
	
}


void selectButton()
{
	//increment
	selectCount++;
	//reset
	if(selectCount == 4)
		selectCount = 0;
		
	
	//initial set sprite frames
	if(selectCount == 0)
	{
		//load background
		PA_SetSpriteAnim(1, 0, 1);
		PA_SetSpriteAnim(1, 1, 2);
		PA_SetSpriteAnim(1, 2, 3);
		PA_SetSpriteAnim(1, 3, 4);
		PA_SetSpriteAnim(1, 4, 5);
		PA_SetSpriteAnim(1, 5, 6);
		PA_SetSpriteAnim(1, 6, 7);
		PA_SetSpriteAnim(1, 7, 8);
		PA_SetSpriteAnim(1, 8, 9);
		PA_SetSpriteAnim(1, 9, 10);
		PA_SetSpriteAnim(1, 10, 11);
		PA_SetSpriteAnim(1, 11, 12);
		
		//clear red dot from mini map
		PA_SetSpriteAnim(1, 63, 0);
		
	}
	else if(selectCount == 1)
	{
		PA_SetSpriteAnim(1, 0, 13);
		PA_SetSpriteAnim(1, 1, 14);
		PA_SetSpriteAnim(1, 2, 15);
		PA_SetSpriteAnim(1, 3, 16);
		
		//display different facial expression based on percent of health
		//660 = 66.0%
		if(player.calculateCurrentHP() >= 330)
			PA_SetSpriteAnim(1, 4, 17);
		else if (player.calculateCurrentHP() < 330)
			PA_SetSpriteAnim(1, 4, 27);
			
		if(player.calculateCurrentHP() >= 660)	
			PA_SetSpriteAnim(1, 5, 18);
		else if(player.calculateCurrentHP() >= 330)
			PA_SetSpriteAnim(1, 5, 25);
		else if(player.calculateCurrentHP() < 330)
			PA_SetSpriteAnim(1, 5, 28);
			
		PA_SetSpriteAnim(1, 6, 19);
		PA_SetSpriteAnim(1, 7, 20);
			
	
		if(player.calculateCurrentHP() >= 330)
			PA_SetSpriteAnim(1, 8, 21);
		else if (player.calculateCurrentHP() < 330)
			PA_SetSpriteAnim(1, 8, 29);
			
		if(player.calculateCurrentHP() >= 660)	
			PA_SetSpriteAnim(1, 9, 22);
		else if(player.calculateCurrentHP() >= 330)
			PA_SetSpriteAnim(1, 9, 26);
		else if(player.calculateCurrentHP() < 330)
			PA_SetSpriteAnim(1, 9, 30);
		
		PA_SetSpriteAnim(1, 10, 23);
		PA_SetSpriteAnim(1, 11, 24);
	}
	else if(selectCount == 2)
	{
		//clear text font sprites
		PA_SetSpriteAnim(1, 12, 0);
		PA_SetSpriteAnim(1, 13, 0);
		PA_SetSpriteAnim(1, 14, 0);
		PA_SetSpriteAnim(1, 15, 0);
		PA_SetSpriteAnim(1, 16, 0);
		PA_SetSpriteAnim(1, 17, 0);
		PA_SetSpriteAnim(1, 18, 0);
		PA_SetSpriteAnim(1, 19, 0);
		PA_SetSpriteAnim(1, 20, 0);
		PA_SetSpriteAnim(1, 21, 0);
		PA_SetSpriteAnim(1, 22, 0);
		PA_SetSpriteAnim(1, 23, 0);
		PA_SetSpriteAnim(1, 24, 0);
		PA_SetSpriteAnim(1, 25, 0);
		PA_SetSpriteAnim(1, 26, 0);
		PA_SetSpriteAnim(1, 27, 0);
		PA_SetSpriteAnim(1, 28, 0);
		PA_SetSpriteAnim(1, 29, 0);
		PA_SetSpriteAnim(1, 30, 0);
		PA_SetSpriteAnim(1, 31, 0);
		PA_SetSpriteAnim(1, 32, 0);
		PA_SetSpriteAnim(1, 33, 0);
		PA_SetSpriteAnim(1, 34, 0);
		PA_SetSpriteAnim(1, 35, 0);
		PA_SetSpriteAnim(1, 36, 0);
		PA_SetSpriteAnim(1, 37, 0);
		PA_SetSpriteAnim(1, 38, 0);
		PA_SetSpriteAnim(1, 39, 0);
		PA_SetSpriteAnim(1, 40, 0);
		PA_SetSpriteAnim(1, 41, 0);
		PA_SetSpriteAnim(1, 42, 0);
		
		//load background
		PA_SetSpriteAnim(1, 0, 31);
		PA_SetSpriteAnim(1, 1, 32);
		PA_SetSpriteAnim(1, 2, 33);
		PA_SetSpriteAnim(1, 3, 34);
		PA_SetSpriteAnim(1, 4, 35);
		PA_SetSpriteAnim(1, 5, 36);
		PA_SetSpriteAnim(1, 6, 37);
		PA_SetSpriteAnim(1, 7, 38);
		PA_SetSpriteAnim(1, 8, 39);
		PA_SetSpriteAnim(1, 9, 40);
		PA_SetSpriteAnim(1, 10, 41);
		PA_SetSpriteAnim(1, 11, 42);
	}
	else if(selectCount == 3)
	{
		//set mini map
		PA_SetSpriteAnim(1, 0, 63);
		PA_SetSpriteAnim(1, 1, 64);
		PA_SetSpriteAnim(1, 2, 65);
		PA_SetSpriteAnim(1, 3, 66);
		PA_SetSpriteAnim(1, 4, 67);
		PA_SetSpriteAnim(1, 5, 68);
		PA_SetSpriteAnim(1, 6, 69);
		PA_SetSpriteAnim(1, 7, 70);
		PA_SetSpriteAnim(1, 8, 71);
		PA_SetSpriteAnim(1, 9, 72);
		PA_SetSpriteAnim(1, 10, 73);
		PA_SetSpriteAnim(1, 11, 74);
		
		//show red dot
		PA_SetSpriteAnim(1, 63, 1);

	
		//clear background masks
		PA_SetSpriteAnim(1, 43, 0);
		PA_SetSpriteAnim(1, 44, 0);
		PA_SetSpriteAnim(1, 45, 0);
		PA_SetSpriteAnim(1, 46, 0);
		PA_SetSpriteAnim(1, 47, 0);
		PA_SetSpriteAnim(1, 48, 0);
		PA_SetSpriteAnim(1, 49, 0);
		PA_SetSpriteAnim(1, 50, 0);
		PA_SetSpriteAnim(1, 51, 0);
		PA_SetSpriteAnim(1, 52, 0);
		PA_SetSpriteAnim(1, 53, 0);
		PA_SetSpriteAnim(1, 54, 0);
		PA_SetSpriteAnim(1, 55, 0);
		PA_SetSpriteAnim(1, 56, 0);
		PA_SetSpriteAnim(1, 57, 0);
		PA_SetSpriteAnim(1, 58, 0);
		/*
		PA_SetSpriteAnim(1, 59, 0);
		PA_SetSpriteAnim(1, 60, 0);
		PA_SetSpriteAnim(1, 61, 0);
		PA_SetSpriteAnim(1, 62, 0);
		*/
		
	}
}
	
		
	

#endif  //__STARTSELECT_H__
